﻿using Acme.ConcreteMixDesign.Topics;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading;
using System.Threading.Tasks;
using Volo.Abp.Threading;

namespace Acme.ConcreteMixDesign.Repositories.Extensions
{
    /// <summary>
    /// 同步的仓储方法(扩展方法)，针对自定义仓储接口进行扩展
    /// </summary>
    public static class TopicRepositoryExtensions
    {
        /// <summary>
        /// 使用APB的异步助手类将异步方法转换为同步方法
        /// </summary>
        /// <param name="topicRepository"></param>
        /// <param name="guid"></param>
        /// <param name="include"></param>
        /// <returns></returns>
        public static Answer FindAnswerById(ITopicRepository topicRepository,Guid guid,bool include=true)
        {
            
            return AsyncHelper.RunSync(
                () => topicRepository.FindAnswerByIdAsync(guid, include)
                );
        }
    }
}
